package com.main.common.utils;

import com.main.common.utils.exceptions.StackTraceLog;

import java.io.InputStream;
import java.util.Properties;

public class ConfigUtil {
    private static final Properties properties = new Properties();

    static {
        try {
            // 加载配置文件
            InputStream inputStream = ConfigUtil.class.getClassLoader().getResourceAsStream("config.properties");
            if (inputStream != null) {
                properties.load(inputStream);
                inputStream.close();
            }
        } catch (Exception e) {
            StackTraceLog stackTraceLog = new StackTraceLog();
            stackTraceLog.saveStackTraceLog(e);
        }
    }

    public static String getProperty(String key) {
        return properties.getProperty(key);
    }
}